﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BLL;
using DAL;
using IDAL;
using Model;
namespace Flowers.Controllers
{
    public class FlowersController : Controller
    {
        BLL.IFactory<IFlowersDal, FlowersDal> bll = new Factory<IFlowersDal, FlowersDal>();
        //
        // GET: /Flowers/

        public ActionResult FlowersIndex()
        {
            ViewBag.list = bll.Fbll().FlowersShow();
            return View();
        }

        public ActionResult fantian(int id)
        {
            ViewBag.list = bll.Fbll().Flowersfantian(id);
            return View();
        }

        public int bianji(FlowersModel m)
        {
            return bll.Fbll().Flowersbianji(m);
        }
        /// <summary>
        /// 停用状态
        /// </summary>
        /// <returns></returns>
        public int FlowersDel()
        {
            int id = Convert.ToInt32(Request["FlowersID"]);
            if (bll.Fbll().FlowersDel(id) > 0)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }


        public int FlowersFull()
        {
            int id = Convert.ToInt32(Request["FlowersID"]);
            if (bll.Fbll().FlowersUpt(id) > 0)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }
        public int getCounts(int id)
        {
            return bll.Fbll().Flowersfantian(id).FlowersStock;
        }
    }
}
